package main

import (
	"fmt"
	"strconv"
)

func main() {
	var s1 = "1"
	i1, err := strconv.Atoi(s1)
	if err != nil {
		return
	}
	fmt.Printf("i1: %d\n", i1)

	s2 := strconv.Itoa(i1)
	fmt.Printf("i2: %s\n", s2)

	parseBool, err := strconv.ParseBool(s2)
	if err != nil {
		return
	}
	fmt.Printf("parseBool: %v\n", parseBool)

	f, err := strconv.ParseFloat("3.1415", 64)
	i, err := strconv.ParseInt("-2", 10, 64)
	u, err := strconv.ParseUint("2", 10, 64)
	fmt.Printf("u: %d,\n i: %d,\n i: %f\n", u, i, f)

	Format()
}

func Format() {
	s1 := strconv.FormatBool(true)
	s2 := strconv.FormatFloat(3.1415, 'E', -1, 64)
	s3 := strconv.FormatInt(-2, 16)
	s4 := strconv.FormatUint(2, 16)
	fmt.Printf("s1: %s, s2: %s, s3: %s, s4: %s\n", s1, s2, s3, s4)
}
